const mongoose = require("mongoose");
const baseModel = require("./baseModel");
//创建news Schema
const schema = mongoose.Schema({
  ...baseModel,
  title: {
    type: String,
    required: true,
  },
  body: {
    type: String,
    required: true,
  },
  img: {
    type: String,
    default: "/images/img/news.jpg",
  },
  author: {
    type: mongoose.SchemaTypes.ObjectId,
    ref: "User",
    required: true,
  },
});

module.exports = mongoose.model("News", schema);
